package com.sinothk.gpserver.modules.biz.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.sinothk.gpserver.modules.biz.entity.AppVersionEntity;
import com.sinothk.gpserver.modules.biz.mapper.AppVersionMapper;
import com.sinothk.gpserver.modules.biz.service.IAppVersionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.sinothk.server.support.entity.PageData;
import com.sinothk.server.support.entity.PageVo;
import com.sinothk.gpserver.util.PageDataUtil;

/**
 * <p>
 * 移动端版本功能 服务实现类
 * </p>
 *
 * @author Liang Y.t.
 * @since 2021-09-14
 */
@Service
public class AppVersionServiceImpl extends ServiceImpl<AppVersionMapper, AppVersionEntity> implements IAppVersionService {

    @Resource
    private AppVersionMapper appVersionMapper;

    /**
     * 查询分页数据
     *
     * @param pageVo 分页参数
     * @return PageData
     */
    @Override
    public PageData<AppVersionEntity> page(PageVo<AppVersionEntity> pageVo) {
        Page<AppVersionEntity> page = new Page<>(pageVo.getPageNum(), pageVo.getPageSize());
        IPage<AppVersionEntity> iPage = appVersionMapper.selectPage(page, null);
        return new PageDataUtil<AppVersionEntity>().create(iPage);
    }

    @Override
    public AppVersionEntity lastVersion() {
        return appVersionMapper.lastVersion();
    }
}
